//
//  XDServerIPSetViewController.m
//  iphone.mobileoa
//
//  Created by 李亚春 on 13-5-31.
//  Copyright (c) 2013年 Epoint. All rights reserved.
//

#import "XDServerIPSetViewController.h"
#import "DBFrameService.h"
#import "TestConnectionTask.h"

@interface XDServerIPSetViewController ()
{
}
@end

@implementation XDServerIPSetViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [UITool setGlossyButtonWithRed:68.0f green:151.0f blue:200.0f :[self.view viewWithTag:1001]];
    [UITool setGlossyButtonWithRed:255.0 green:4.0f blue:61.0f :[self.view viewWithTag:1002]];
    
    [self.tvIP setText:[DBFrameService getConfigValue:EP_ConfigKey_wsurl]];
    
    self.title = @"服务器设置";
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)dealloc {
    [_tvIP release];
    [super dealloc];
}
- (void)viewDidUnload {
    [self setTvIP:nil];
    [super viewDidUnload];
}

#pragma control

- (IBAction)testURL:(id)sender {
    NSString *testurl = self.tvIP.text;
    NSMutableDictionary *params = self.getPassDictionary;
    [params setObject:testurl forKey:@"testurl"];
    [[[TestConnectionTask alloc]initWithContext:self andParams:params]startTask];
}

- (IBAction)saveIP:(id)sender {
    [DBFrameService setConfigValue:EP_ConfigKey_wsurl value:self.tvIP.text];
    [UITool toast:@"保存成功"];
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)refreshUIWithThreadGuid:(NSString *)threadGuid andData:(NSObject *)obj{}

@end
